# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=2
inherit eutils qt4

MY_PV="${PV/_beta/.b}"
MY_P="${PN}-${MY_PV}"

DESCRIPTION="Beaver Debugger is free cross-platform debugger (GDB frontend)."
HOMEPAGE="http://beaverdbg.googlecode.com/"
SRC_URI="http://${PN}.googlecode.com/files/${MY_P}.tar.gz"

LICENSE="LGPL-2.1"
SLOT="0"

KEYWORDS="~x86 ~amd64"

IUSE=""

RESTRICT="primaryuri"

DEPEND="x11-libs/qt-core:4
        x11-libs/qt-gui:4
        x11-libs/qt-assistant:4
        x11-libs/qt-webkit:4"

RDEPEND="${DEPEND}"

S="${WORKDIR}/${MY_P}"

PATCHES="${FILESDIR}/0001-Fix-linking-error-with-QtWebKit.patch
         ${FILESDIR}/0002-Fix-app.pro-to-respect-BEAVER_-LINK_-PREFIX.patch"

src_configure() {
    eqmake4 qtcreator.pro BEAVER_PREFIX="/usr"
}

src_install() {
    emake INSTALL_ROOT="${D}" install || die "emake install failed"

    rm "${D}/usr/bin/${PN}" # Permissions are set incorrectly by qmake.
    dobin "${S}/bin/${PN}"

    doicon "${S}/src/app/${PN}.png"

    rm "${D}/usr/share/applications/${PN}.desktop"
    make_desktop_entry ${PN} "Beaver Debugger" ${PN} \
        "Development;Qt;IDE"

}
